import { defineComponent, h } from 'vue';

export default defineComponent({
  name: 'CustomTableColumn',
  props: {
    // 如果有其他需要接收的props，请在这里定义
    currentPage: Number,
    pageSize: Number
  },
  setup(props, { slots, attrs }) {
    const index = (index) => {
      if (attrs.type === 'index' && props.currentPage && props.pageSize) {
        return (props.currentPage - 1) * props.pageSize + index + 1;
      }
      return index;
    };

    return () =>
      h(
        'el-table-column',
        {
          ...attrs,
          index: index
        },
        slots.default ? slots.default() : undefined
      );
  }
});
